#include "businesslogic.h"
#include <QSqlQuery>
#include <QJsonArray>
#include <QJsonObject>

BusinessLogic::BusinessLogic() {
    dbManager = SqliteManager::getInstance();
}

QJsonArray BusinessLogic::getAttendList() {
    QJsonArray array;
    QSqlQuery query = dbManager->execQuery("SELECT * FROM attend ORDER BY time DESC");

    while (query.next()) {
        QJsonObject obj;
        obj["id"] = query.value("id").toInt();
        obj["userId"] = query.value("user_id").toString();
        obj["time"] = query.value("time").toString();
        array.append(obj);
    }
    return array;
}

bool BusinessLogic::RegisterEmployee()
{

}
